
#ifndef _Oz_Webui_Exception_H_
#define _Oz_Webui_Exception_H_

/**
 * Author: pepone.onrez@gmail.com
 * Date: 18-January-2008
 * License: GPL-V3
 * Copyright: pepone.onrez@gmail.com (2008)
 **/

#include <exception>
#include <string>

namespace Oz{
    namespace Webui{

        /**
         * This class is a base exception for all exceptions in this package.
         **/
        class Exception : public std::exception{
            public:
            virtual ~Exception() throw();
            virtual const char* what()const throw() = 0;
        };

        class UserException : public Exception{
            public:
            virtual ~UserException() throw();
            virtual const char* what()const throw() = 0;
        };

        /**
         * This class is a base exception for InternalErros of this package.
         **/
        class InternalException : public Exception{
            protected:
            std::string _file;
            int _line;
            std::string _what;
            public:
            InternalException(const std::string& file,int line,const std::string& what);
            virtual ~InternalException()throw();
            virtual const char* what()const throw();
        };

        /**
         * This exception indicate that the requested page not exist.
         * this correspond to a 404 http error.
         **/
        class WebPageNotFoundException : public UserException{
            protected:
            std::string _uri;
            public:
            WebPageNotFoundException(const std::string& uri);
            virtual ~WebPageNotFoundException() throw();
            virtual const char* what()const throw();
        };

        /**
         * This exception is throw when same body trys to add
         * a child view with the name of a existing view.
         **/
        class ChilViewAllreadyExitsException : public UserException{
            protected:
            std::string _name;
            public:
            ChilViewAllreadyExitsException(const std::string& name);
            virtual ~ChilViewAllreadyExitsException() throw();
            virtual const char* what()const throw();
        };

        /**
         * This exception is throw when a child view with the
         * given name not exist.
         **/
        class ChilViewNotFoundException : public UserException{
            protected:
            std::string _name;
            public:
            ChilViewNotFoundException(const std::string& name);
            virtual ~ChilViewNotFoundException() throw();
            virtual const char* what()const throw();
        };
    }
}
#endif
